package com.wechatapp.mengyao.poetry.controller;

import com.wechatapp.mengyao.poetry.core.RestResponse;
import com.wechatapp.mengyao.poetry.service.GlobalConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author yanghuaxu
 * @date 2025/9/7 17:24
 */
@RestController
@RequestMapping("/api/v1/global_config")
public class GlobalConfigController {

    @Autowired
    private GlobalConfigService configService;

    @GetMapping("/{configKey}")
    public RestResponse<Map> getConfig(@PathVariable String configKey) {
        return RestResponse.ok(configService.getConfig(configKey, Map.class));
    }

}
